﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Locator.Silverlight.Client.Models;
using System.Text;
using Microsoft.Maps.MapControl;
using Locator.Silverlight.Client.Models.ViewModels.Elements;
using Locator.Silverlight.Client.Models.ViewModels;

namespace Locator.Silverlight.Client
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void StackPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            StackPanel panel = sender as StackPanel;
            StoreWithInventoryViewModel currentStoreWithInventory = panel.DataContext as StoreWithInventoryViewModel;
            this.mapDrinks.SetView(currentStoreWithInventory.Location, 14);
        }

        private void Pushpin_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Pushpin pin = sender as Pushpin;
            StoreWithInventoryViewModel store = pin.DataContext as StoreWithInventoryViewModel;
            ViewModelLocator.ResultDetailsStatic.StoreWithInventory = store;
            ResultDetails details = new ResultDetails();
            details.Show();
        }

        private void buttonManageProducts_Click(object sender, RoutedEventArgs e)
        {
            ManageProducts manageProducts = new ManageProducts();
            manageProducts.Show();
        }

        private void buttonManageLocations_Click(object sender, RoutedEventArgs e)
        {
            ManageStores manageStores = new ManageStores();
            manageStores.Show();
        }

        private void buttonManagePersonalLocations_Click(object sender, RoutedEventArgs e)
        {
            ManagePersonalLocations manageLocations = new ManagePersonalLocations();
            manageLocations.Show();
        }

        private void buttonSettings_Click(object sender, RoutedEventArgs e)
        {
            Settings settings = new Settings();
            settings.Show();
        }
    }
}
